package com.yanqu.road.server.gameplayer.module.activity.lottery;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.lottery.ActivityLotteryInfo;
import com.yanqu.road.entity.activity.lottery.ActivityLotteryParamInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class ActivityLotteryConfig {

    private ActivityInfo activityInfo;

    private List<ActivityLotteryInfo> lotteryInfoList;

    private Map<Integer,ActivityLotteryParamInfo> lotteryParamInfoMap;

    private String cost;                    // 服装抽取消耗（道具id=数量）
    private String tenCost;                 // 服装十连抽取消耗（道具id=数量）
    private List<Integer> luckyParam;       // 服装前n次抽盲盒，活动共享m*服务器数量个隐藏款；抽取的概率千分比（无隐藏款配0）
    private List<Integer> addParam;         // 服装累计抽取m次后，每次抽取增加权重
    private List<String> controlList;       // 服装保底次数，4;20 代表当前抽奖达到20次时，若总获取低于4个不重复的，则下次一定获得新奖励（无隐藏款配0）

    /**
     * 积分道具id
     */
    private int EXCHANGE_SCORE_ITEM_ID = 0;
    /**
     * 必定大奖次数
     */
    private int sureBigNum = 0;
    //主活动类型
    private int activityType;

    /**
     * 皮肤是否可自由切换
     */
    private int skinChange = 0;

    public ActivityLotteryConfig(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    /**
     * 获取共享大奖的前n次
     */
    /**
     * 获取共享大奖的前n次
     */
    public int getShareNTimes(){
        if(luckyParam.size() == 0){
            return 0;
        }
        return luckyParam.get(0);
    }


    public int getShareWeigh(){
        return luckyParam.get(2);
    }


    public List<ActivityLotteryInfo> getLotteryInfoList() {
        return lotteryInfoList;
    }

    public Map<Integer, ActivityLotteryParamInfo> getLotteryParamInfoMap() {
        return lotteryParamInfoMap;
    }

    public void setLotteryInfoList(List<ActivityLotteryInfo> lotteryInfoList) {
        this.lotteryInfoList = lotteryInfoList;
    }

    public void setLotteryParamInfoMap(Map<Integer,ActivityLotteryParamInfo> lotteryParamInfoMap) {
        this.lotteryParamInfoMap = lotteryParamInfoMap;
    }

    //随便给一个皮肤怼上去
    public int getLotteryDefault(){
        if(lotteryParamInfoMap.size() > 0){
            List<Integer> keyList = new ArrayList<>(lotteryParamInfoMap.keySet());
            return keyList.get(0);
        }
        return 0;
    }

    public String getCost() {
        return cost;
    }

    public List<Integer> getLuckyParam() {
        return luckyParam;
    }

    public List<Integer> getAddParam() {
        return addParam;
    }

    public List<String> getControlList() {
        return controlList;
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public void setActivityInfo(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public void setCost(String cost) {
        this.cost = cost;
    }

    public void setLuckyParam(List<Integer> luckyParam) {
        this.luckyParam = luckyParam;
    }

    public void setAddParam(List<Integer> addParam) {
        this.addParam = addParam;
    }

    public void setControlList(List<String> controlList) {
        this.controlList = controlList;
    }

    public int getActivityType() {
        return activityType;
    }

    public void setActivityType(int activityType) {
        this.activityType = activityType;
    }

    public int getActivityId() {
        return activityInfo.getActivityId();
    }

    public int getEXCHANGE_SCORE_ITEM_ID() {
        return EXCHANGE_SCORE_ITEM_ID;
    }

    public void setEXCHANGE_SCORE_ITEM_ID(int EXCHANGE_SCORE_ITEM_ID) {
        this.EXCHANGE_SCORE_ITEM_ID = EXCHANGE_SCORE_ITEM_ID;
    }

    public String getTenCost() {
        return tenCost;
    }

    public void setTenCost(String tenCost) {
        this.tenCost = tenCost;
    }

    public boolean containsSkinId(int skinId) {
        return lotteryParamInfoMap.containsKey(skinId) || skinId == 0;
    }

    public int getSureBigNum() {
        return sureBigNum;
    }

    public void setSureBigNum(int sureBigNum) {
        this.sureBigNum = sureBigNum;
    }

    public int getSkinChange() {
        return skinChange;
    }

    public void setSkinChange(int skinChange) {
        this.skinChange = skinChange;
    }
}
